home *** CD-ROM | disk | FTP | other *** search
/ HPAVC / HPAVC CD-ROM.iso / PCGPEV10.ZIP / VESASP12.TXT < prev    next >
Text File  |  1994-05-10  |  58KB  |  1,135 lines

  1. VESA                                                         Super VGA Standard
  2. Video Electronics Standards Association
  3. ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  4. 2150 North First Street, Suite 360                        Phone: (408) 435-0333
  5. San Jose, CA 95131-2020                                     Fax: (408) 435-8225
  6.  
  7.                             Super VGA BIOS Extension
  8.                                Standard #VS911022
  9.                                 October 22, 1991
  10.                               Document Version 1.0
  11.                                 VBE Version 1.2
  12.  
  13. PURPOSE
  14. ~~~~~~~
  15. To standardize a common software interface to Super VGA video adapters in order
  16. to provide simplified software application access to advanced VGA products.
  17.  
  18. SUMMARY
  19. ~~~~~~~
  20. The standard provides a  set of functions which an application program can use
  21. to A) obtain information about the capabilities and characteristics of a
  22. specific Super VGA implementation and B) to control the operation of such
  23. hardware in terms of video mode initialization and video memory access.  The
  24. functions are provided as an extension to the VGA BIOS video services, accessed
  25. through interrupt 10h.
  26.  
  27.                       VESA Super VGA Standard VS911022-2
  28.  
  29. Contents
  30. ~~~~~~~~
  31. 1.      Introduction ................................................. Page 3
  32.  
  33. 2.      Goals and Objectives .........................................      4
  34.         2.1     Video environment information ........................      4
  35.         2.2     Programming support ..................................      4
  36.         2.3     Compatibility ........................................      5
  37.         2.4     Scope of standard ....................................      5
  38.  
  39. 3.      Standard VGA BIOS ............................................      6
  40.  
  41. 4.      Super VGA Mode Numbers .......................................      7
  42.  
  43. 5.      CPU Video Memory Control .....................................      9
  44.         5.1     Hardware design consideration ........................      9
  45.                 5.1.1   Limited to 64k/128k of CPU address space .....      9
  46.                 5.1.2   Crossing CPU video memory window boundaries ..     10
  47.                 5.1.3   Operating on data frolm different areas ......     10
  48.                 5.1.4   Combining data from two different windows ....     10
  49.         5.2     Different types of hardware windows ..................     11
  50.                 5.2.1   Single window systems ........................     11
  51.                 5.2.2   Dual window systems ..........................     11
  52.  
  53. 6.      Extended VGA BIOS ............................................     12
  54.         6.1     Status Information ...................................     12
  55.         6.2     00h - Return Super VGA Information ...................     12
  56.         6.3     01h - Return Super VGA mode information ..............     14
  57.         6.4     02h - Set Super VGA mode .............................     20
  58.         6.5     03h - Return Super VGA mode ..........................     20
  59.         6.6     04h - Save/restore Super VGA video state .............     21
  60.         6.7     05h - Super VGGA video memory window control .........     22
  61.         6.8     06h - Set/Get Logical Scan Line Length ...............     23
  62.         6.9     07h - Set/Get Display Start ..........................     24
  63.         6.10    08h - Set/Get DAC Palette Control ....................     25
  64.  
  65. 7.      Application Example ..........................................     26
  66.  
  67.                       VESA Super VGA Standard VS911022-3
  68.  
  69. 1.      Introduction
  70. ~~~~~~~~~~~~~~~~~~~~
  71. This document contains a specification for a standardized interface to extended
  72. VGA video modes and functions.  The specification consists of mechanisms for
  73. supporting standard extended video modes and functions that have been approved
  74. by the main VESA committee and non-standard video modes that an individual VGA
  75. supplier may choose to add, in a uniform manner that application software can
  76. utilize without having to understand the intricate details of the particular VGA
  77. hardware.
  78.  
  79. The primary topics of this specification are definitions of extended VGA video
  80. modes and the functions necessary for application software to understand the
  81. characteristics of the video mode and manipulate the extended memory associated
  82. with the video mode.
  83.  
  84. Readers of this document should already be familiar with programming VGAs at the
  85. hardware level and Intel iAPX real mode assembly language.  Readers who are
  86. unfamiliar with programming the VGA should first read one of the many VGA
  87. programming tutorials before attempting to understand these extensions to the
  88. standard VGA.
  89.  
  90.                       VESA Super VGA Standard VS911022-4
  91.  
  92. 2.      Goals and Objectives
  93. ~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  94. The IBM VGA has become a defacto standard in the PC graphics world.  A multitude
  95. of different VGA offerings exist in the marketplace, each one providing BIOS or
  96. register compatibility with the IBM VGA.  More and more of these VGA compatible
  97. products implements various supersets of the VGA standard.  These extensions
  98. range from higher resolutions and more colors to improved performance and even
  99. some graphics processing capabilities.  Intense competition has dramatically
  100. improved the price/performance ratio, to the benefit of the end user.
  101.  
  102. However, several serious problems face a software developer who intends to take
  103. advantage of these "Super VGA" environments.  Because there is no standard
  104. hardware implementation, the developer is faced with widely disparate Super VGA
  105. hardware architectures.  Lacking a common software interface, designing
  106. applications for these environments is costly and technically difficult.  Except
  107. for applications supported by OEM-specific display drivers, very few software
  108. packages can take advantage of the power and capabilities of Super VGA products.
  109.  
  110. The purpose of the VESA VGA BIOS Extension is to remedy this situation.  Being a
  111. common software interface to Super VGA graphics products, the primary objective
  112. is to enable application and system software to adapt to and exploit the wide
  113. range of features available in these VGA extensions.
  114.  
  115. Specifically, the VESA BIOS Extension attempts to address the following issues:
  116. A) Return information about the video environment to the application, and B)
  117. Assist the application in initializing and programming the hardware.
  118.  
  119. 2.1             Video environment information
  120.  
  121. Today, an application has no standard mechanism to determine what Super VGA
  122. hardware it is running on.  Only by knowing OEM-specific features can an
  123. application determine the presence of a particular video board.  This often
  124. involves reading and testing registers located at I/O addresses unique to each
  125. OEM.  By not knowing what hardware an application is running on, few, if any, of
  126. the extended features of the underlying hardware can be used.
  127.  
  128. The VESA BIOS Extension provides several functions to return information about
  129. the video environment.  These functions return system level information as well
  130. as video mode specific details.  Function 00h returns general system level
  131. information, including an OEM identification string.  The function also returns
  132. a pointer to the supported video modes.  Function 01h may be used by the
  133. application to obtain information about each supported video mode.  Function 03h
  134. returns the current video mode.
  135.  
  136.                       VESA Super VGA Standard VS911022-5
  137.  
  138. 2.2             Programming support
  139.  
  140. Due to the fact that different Super VGA products have different hardware
  141. implementations, application software has great difficulty in adapting to each
  142. environment.  However, since each is based on the VGA hardware architecture,
  143. differences are most common in video mode initialization and memory mapping.
  144. The rest of the architecture is usually kept intact, including I/O mapped
  145. registers, video buffer location in the CPU address space, DAC location and
  146. function, etc.
  147.  
  148. The VESA BIOS Extension provides several functions to interface to the different
  149. Super VGA hardware implementations.  The most important of these is Function
  150. 02h, Set Super VGA video mode.  This function isolates the application from the
  151. tedious and complicated task of setting up a video mode.  Function 05h provides
  152. an interface to the underlying memory mapping hardware.  Function 04h enables an
  153. application to save and restore a Super VGA state without knowing anything of
  154. the specific implementation.
  155.  
  156. 2.3             Compatibility
  157.  
  158. A primary design objective of the VESA BIOS Extension is to preserve maximum
  159. compatibility to the standard VGA environment.  In no way should the BIOS
  160. extensions compromise compatibility or performance.  Another but related concern
  161. is to minimiza the changes necessary to an existing VGA BIOS.  Ram, as well as
  162. ROM-based implementations of the BIOS extension should be possible.
  163.  
  164. 2.4             Scope of standard
  165.  
  166. The purpose of the VESA BIOS Extension is to provide support for extended VGA
  167. environments.  Thus, the underlying hardware architecture is assumed to be a
  168. VGA.  Graphics software that drives a Super VGA board will perform its graphics
  169. output in generally the same way it drives a standard VGA, i.e. writing directly
  170. to a VGA style frame buffer, manipulating graphics controller registers,
  171. directly programming the palette, etc.  No significant graphics processing will
  172. be done in hardware.  For this reason, the VESA BIOS Extension does not provide
  173. any graphics output functions, such as BitBlt, line or circle drawing, etc.
  174.  
  175. An important constraint of the functionalities that can be placed into the VESA
  176. BIOS Extension is that ROM space is severely limited in certain existing BIOS
  177. implementations.
  178.  
  179. Outside the scope of this VESA BIOS Extension is the handling of different
  180. monitors and monitor timings.  Such items are dealt with in other VESA fora.
  181. The purpose of the VESA BIOS Extension is to provide a standardized software
  182. interface to Super VGA graphics modes, independent of monitor and monitor timing
  183. issues.
  184.  
  185.                       VESA Super VGA Standard VS911022-6
  186.  
  187. 3.      Standard VGA BIOS
  188. ~~~~~~~~~~~~~~~~~~~~~~~~~
  189. A primary design goal with the VESA BIOS Extension is to minimize the effects on
  190. the standard VGA BIOS.  Standard VGA BIOS functions should need to be modified
  191. as little as possible.  This is important since ROM, as well as RAM based
  192. versions of the extensions, may be implemented.
  193.  
  194. However, two standard VGA BIOS functions are affected by the VESA extension.
  195. These are Function 00h (Set video mode) and Function 0Fh (Read current video
  196. state).  VESA-aware applications will not set the video mode using VGA BIOS
  197. function 00h.  Nor will such applications use VGA BIOS function 0Fh.  VESA BIOS
  198. functions 02h (Set Super VGA mode) and 03h (Get Super VGA mode) will be used
  199. instead.
  200.  
  201. However, VESA-unaware applications (such as old Pop-Up programs and other TSRs,
  202. or the CLS command of MS-DOS), might use VGA BIOS function 0Fh to get the
  203. present video mode.  Later it may call VGA BIOS function 00h to
  204. restore/reinitialize the old video mode.
  205.  
  206. To make such applications work, VESA recommends that whatever value returned by
  207. VGA BIOS function 0Fh (it is up to the OEM to define this number) should be used
  208. to reinitialize the video mode through VGA BIOS function 00h.  Thus, the BIOS
  209. should keep track of the last Super VGA mode in effect.
  210.  
  211. It is recommended, but not mandatory, to support output functions (such as
  212. TTY-output, scroll, set pixel, etc.) in Super VGA modes.  If the BIOS extension
  213. doesn't support such output functions, bit D2 (Output functions supported) of
  214. the ModeAttributes field (returned by VESA BIOS function 01h) should be clear.
  215.  
  216.                       VESA Super VGA Standard VS911022-7
  217.  
  218. 4.      Super VGA mode numbers
  219. ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  220. Standard VGA mode numbers are 7 bits wide and presently range from 00h to 13h.
  221. OEMs have defined extended video modes in the range 14h to 7Fh.  Values in the
  222. range 80h to FFh cannot be used, since VGA BIOS function 00h (Set video mode)
  223. interprets bit 7 as a flag to clear/not clear video memory.
  224.  
  225. Due to the limitations of 7 bit mode numbers, VESA video mode numbers are 15
  226. bits wide.  To initialize a Super VGA mode, its number is passed in the BX
  227. register to VESA BIOS function 02h (Set Super VGA mode).
  228.  
  229. The format of VESA mode numbers is as follows:
  230.  
  231. D0-D8  = Mode number
  232.               If D8 == 0, this is not a VESA defined mode
  233.               If D8 == 1, this is a VESA defined mode
  234. D9-D14 = Reserved by VESA for future expansion (= 0)
  235. D15    = Reserved (= 0)
  236.  
  237. Thus, VESA mode numbers begin at 100h.  This mode numbering scheme implements
  238. standard VGA mode numbers as well as OEM-defined mode numbers as subsets of the
  239. VESA mode number.  That means that regular VGA modes may be initialized through
  240. VESA BIOS function 02h (Set Super VGA mode), simply by placing the mode number
  241. in BL and clearing the upper byte (BH).  OEM-defined modes may be initialized in
  242. the same way.
  243.  
  244. To date, VESA has defined a 7-bit video mode number, 6Ah, for the 800x600,
  245. 16-color, 4-plane graphics mode.  The corresponding 15-bit mode number for this
  246. mode is 102h.
  247.  
  248. The following VESA mode numbers have been defined:
  249.  
  250.                 GRAPHICS                                TEXT
  251.  
  252. 15-bit   7-bit    Resolution   Colors   15-bit   7-bit    Columns   Rows
  253. mode     mode                           mode     mode
  254. number   number                         number   number
  255. ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~   ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  256. 100h     -        640x400      256      108h     -        80        60
  257. 101h     -        640x480      256
  258.                                         109h     -        132       25
  259. 102h     6Ah      800x600      16       10Ah     -        132       43
  260. 103h     -        800x600      256      10Bh     -        132       50
  261.                                         10Ch     -        132       60
  262. 104h     -        1024x768     16
  263. 105h     -        1024x768     256
  264.  
  265. 106h     -        1280x1024    16
  266. 107h     -        1280x1024    256
  267.  
  268.                       VESA Super VGA Standard VS911022-8
  269.  
  270. 10Dh     -        320x200      32K   (1:5:5:5)
  271. 10Eh     -        320x200      64K   (5:6:5)
  272. 10Fh     -        320x200      16.8M (8:8:8)
  273. 110h     -        640x480      32K   (1:5:5:5)
  274. 111h     -        640x480      64K   (5:6:5)
  275. 112h     -        640x480      16.8M (8:8:8)
  276. 113h     -        800x600      32K   (1:5:5:5)
  277. 114h     -        800x600      64K   (5:6:5)
  278. 115h     -        800x600      16.8M (8:8:8)
  279. 116h     -        1024x768     32K   (1:5:5:5)
  280. 117h     -        1024x768     64K   (5:6:5)
  281. 118h     -        1024x768     16.8M (8:8:8)
  282. 119h     -        1280x1024    32K   (1:5:5:5)
  283. 11Ah     -        1280x1024    64K   (5:6:5)
  284. 11Bh     -        1280x1024    16.8M (8:8:8)
  285.  
  286.                       VESA Super VGA Standard VS911022-9
  287.  
  288. 5.      CPU Video Memory Windows
  289. ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  290. A standard VGA sub-system provides 256k bytes of memory and a corresponding
  291. mechanism to address this memory.  Super VGAs and their modes require more than
  292. the standard 256k bytes of memory but also require that the address space for
  293. this memory be restricted to the standard address space for compatibility
  294. reasons.  CPU video memory windows provide a means of accessing this extended
  295. VGA memory within the standard CPU address space.
  296.  
  297. This chapter describes how several hardware implementations of CPU video memory
  298. windows operate, their impact on application software design, and relates them
  299. to the software model presented by the VESA VGA BIOS extensions.
  300.  
  301. The VESA CPU video memory windows functions have been designed to put the
  302. performance insensitive, non-standard hardware functions into the BIOS while
  303. putting the performance sensitive, standard hardware functions into the
  304. application.  This provides portability among VGA systems together with the
  305. performance that comes from accessing the hardware directly.  In particular, the
  306. VESA BIOS is responsible for mapping video memory into the CPU address space
  307. while the application is responsible for performing the actual memory read and
  308. write operations.
  309.  
  310. This combination software and hardware interface is accomplished by informing
  311. the application of the parameters that control the hardware mechanism of mapping
  312. the video memory into the CPU address space and then letting the application
  313. control the mapping within those parameters.
  314.  
  315. 5.1             Hardware
  316. 5.1.1           Limited to 64k/128k of CPU address space
  317.  
  318. The first consideration in implementing extended video memory is to give access
  319. to the memory to application software.
  320.  
  321. The standard VGA CPU address space for 16 color graphics modes is typically at
  322. segment A000h for 64k.  This gives access to the 256k bytes of a standard VGA,
  323. i.e. 64k per plane.  Access to the extended video memory is accomplished by
  324. mapping portions of the video memory into the standard VGA CPU address space.
  325.  
  326. Every Super VGA hardware implementation provides a mechanism for software to
  327. specify the offset from the start of video memory which is to be mapped to the
  328. start of the CPU address space.  Providing both read and write access to the
  329. mapped memory provides a necessary level of hardware support for an application
  330. to manipulate the extended video memory.
  331.  
  332.                       VESA Super VGA Standard VS911022-10
  333.  
  334. 5.1.2           Crossing CPU video memory window boundaries
  335.  
  336. The organization of most software algorithms which perform video operations
  337. consists of a pair of nested loops: and outer loop over rows or scan lines and
  338. an inner loop across the row or scan line.  The latter is the proverbial inner
  339. loop, which is the bottle neck to high performance software.
  340.  
  341. If a target rectangle is large enough, or poorly located, part of the required
  342. memory may be with within the video memory mapped into the CPU address space and
  343. part of it may not be addressable by the CPU without changing the mapping.  It
  344. is desirable that the test for remapping the video memory is located outside of
  345. the inner loop.
  346.  
  347. This is typically accomplished by selecting the mapping offset of the start of
  348. video memory to the start of the CPU address space so that at least one entire
  349. row or scan line can be processed without changing the video memory mapping.
  350. There are currently no Super VGAs that allow this offset to be specified on a
  351. byte boundary and there is a wide range among Super VGAs in the ability to
  352. position a desired video memory location at the start of the CPU address space.
  353.  
  354. The number of bytes between the closest two bytes in video memory that can be
  355. placed on any single CPU address is defined as the granularity of the window
  356. function.  Some Super VGA systems allow any 4k video memory boundary to be
  357. mapped to the start of the CPY address space, while other Super VGA systems
  358. allow any 64k video memory boundary to be mapped to the start of the CPU address
  359. space.  These two example systems would have granularities of 4k and 64k,
  360. respectively.  This concept is very similar to the bytes that can be accessed
  361. with a 16 bit pointer in an Intel CPU before a segment register must be changed
  362. (the granularity of the segment register or mapping here is 16 bytes).
  363.  
  364. Notes
  365. ~~~~~
  366. If the granularity is equal to the length of the CPU address space, i.e. the
  367. least significant address bit of the hardware mapping function is more
  368. significant than the most significant bit of the CPU address, then the inner
  369. loop will have to contain the test for crossing the end or beginning of the CPU
  370. address space.  This is because if the length of the CPU address space (which is
  371. the granularity in this case) is not evenly divisible by the length of a scan
  372. line, then the scan line at the end of the CPU address will be in two different
  373. video memory which cannot be mapped into the CPU address space simultaneously.
  374.  
  375. 5.1.3           Operating on data from different areas
  376.  
  377. It is sometimes required or convenient to move or combine data from two
  378. different areas of video memory.  One example of this is storing menus in the
  379. video memory beyond the displayed memory because there is hardware support in
  380. all VGAs for transferring 32 bits of video data with an 8 bit CPU read and
  381. write.  Two separately mappable CPU video memory windows must be used if the
  382. distance between the source and destination is larger than the size of the CPU
  383. video memory window.
  384.  
  385. 5.1.4           Combining data from two different windows
  386.  
  387. The above example of moving data from one CPU video memory window to another CPU
  388. video memory only required read access to one window and only required write
  389. access to the other window.  Sometimes it is convenient to have read access to
  390. both windows and write access to one window.  An example of this would be a
  391. raster operation where the resulting destination is the source data logically
  392. combined with the original destination data.
  393.  
  394.                       VESA Super VGA Standard VS911022-11
  395.  
  396. 5.2             Different types of hardware windows
  397.  
  398. Different hardware implementations of CPU video memory windows can be supported
  399. by the VESA BIOS extension.  The information necessary for an application to
  400. understand the type of hardware implementation is provided by the BIOS to the
  401. application.  There are three basic types of hardware windowing implementations
  402. and they are described below.
  403.  
  404. The types of windowing schemes described below do not include differences in
  405. granularity.
  406.  
  407. Also note that is possible for a VGA to use a CPU address space of 128k starting
  408. at segment A000h.
  409.  
  410. 5.2.1           Single window systems
  411.  
  412. Some hardware implementations only provide a single window.  This single window
  413. will be readable as well as writeable.  However, this causes a significant
  414. performance degradation when moving data in video memory a distance that is
  415. larger than the CPU address space.
  416.  
  417. 5.2.2           Dual window systems
  418.  
  419. Many Super VGAs provide two windows to facilitate moving data within video
  420. memory.  There are two separate methods of providing two windows.
  421.  
  422. 5.2.2.1         Overlapping windows
  423.  
  424. Some hardware implementations distinguish window A and window B by determining
  425. if the CPU is attempting to do a memory read or a memory write operation.  When
  426. the two windows are distinguished by whether the CPU is trying to read or write
  427. they can, and usually do, share the same CPU address space.  However, one window
  428. will be read only and the other will be write only.
  429.  
  430. 5.2.2.2         Non-overlapping windows
  431.  
  432. Another mechanism used by two window systems to distinguish window A and window
  433. B is by looking at the CPU address within the total VGA CPU address space.  When
  434. the two windows are distinguished by the CPU address within the VGA CPU address
  435. space the windows cannot share the same address space, but they can each be both
  436. read and written.
  437.  
  438.                       VESA Super VGA Standard VS911022-12
  439.  
  440. 6.      Extended VGA BIOS
  441. ~~~~~~~~~~~~~~~~~~~~~~~~~
  442. Several new BIOS calls have been defined to support Super VGA modes.  For
  443. maximum compatibility with the standard VGA BIOS, these calls are grouped under
  444. one function number.  This number is passed in the AH register to the INT 10h
  445. handler.
  446.  
  447. The designated Super VGA extended function number is 4Fh.  This function number
  448. is presently unused in most, if not all, VGA BIOS implementations.  A standard
  449. VGA BIOS performs no action when function call 4Fh is made.  Super VGA Standard
  450. VS900602 defines subfunctions 00h through 07h.  Subfunction numbers 08h through
  451. 0FFh are reserved for future use.
  452.  
  453. 6.1             Status Information
  454.  
  455. Every function returns status information in the AX register.  The format of the
  456. status word is as follows:
  457.  
  458.         AL == 4Fh:      Function is supported
  459.         Al != 4Fh:      Function is not supported
  460.         AH == 00h:      Function call successful
  461.         AH == 01h:      Function call failed
  462.  
  463. Software should treat a non-zero value in the AH register as a general failure
  464. condition.  In later versions of the VESA BIOS Extension new error codes might
  465. be defined.
  466.  
  467. 6.2             Function 00h - Return Super VGA Information
  468.  
  469. The purpose of this function is to provide information to the calling program
  470. about the general capabilities of the Super VGA environment.  The function fills
  471. an information block structure at the address specified by the caller.  The
  472. information block size is 256 bytes.
  473.  
  474.         Input:  AH = 4Fh        Super VGA support
  475.                 AL = 00h        Return Super VGA information
  476.                 ES:DI = Pointer to buffer
  477.  
  478.         Output: AX = Status
  479.                 (All other registers are preserved)
  480.  
  481.                       VESA Super VGA Standard VS911022-13
  482.  
  483. The information block has the following structure:
  484.  
  485. VgaInfoBlock    STRUC
  486.       VESASignature   db   'VESA'      ; 4 signature bytes
  487.       VESAVersion     dw   ?           ; VESA version number
  488.       OEMStringPtr    dd   ?           ; Pointer to OEM string
  489.       Capabilities    db   4 dup(?)    ; capabilities of the video environment
  490.       VideoModePtr    dd   ?           ; pointer to supported Super VGA modes
  491.       TotalMemory     dw   ?           ; Number of 64kb memory blocks on board
  492.       Reserved        db   236 dup(?)  ; Remainder of VgaInfoBlock
  493. VgaInfoBlock    ENDS
  494.  
  495. The VESASignature field contains the characters 'VESA' if this is a valid block.
  496.  
  497. The VESAVersion is a binary field which specifies what level of the VESA
  498. standard the Super VGA BIOS conforms to.  The higher byte specifies the major
  499. version number.  The lower byte specifies the minor version number.  The current
  500. VESA version number is 1.2.  Applications written to use the features of a
  501. specific version of the VESA BIOS Extension, are guaranteed to work in later
  502. versions.  The VESA BIOS Extension will be fully upwards compatible.
  503.  
  504. The OEMStringPtr is a far pointer to a null terminated OEM-defined string.  The
  505. string may used to identify the video chip, video board, memory configuration,
  506. etc. to hardware specific display drivers.  There are no restrictions on the
  507. format of the string.
  508.  
  509. The Capabilities field describes what general features are supported in the
  510. video environment.  The bits are defined as follows:
  511.  
  512.         D0      = DAC is switchable
  513.                   0 = DAC is fixed width, with 6-bits per primary color
  514.                   1 = DAC width is switchable
  515.         D1-31   = Reserved
  516.  
  517. The VideoModePtr points to a list of supported Super VGA (VESA-defined as well
  518. as OEM-specific) mode numbers.  Each mode number occupies one word (16 bits).
  519. The list of mode numbers is terminated by a -1 (0FFFFh).  Please refer to
  520. chapter 2 for a description of VESA mode numbers.  The pointer could point into
  521. either ROM or RAM, depending on the specific implementation.  Either the list
  522. would be a static string stored in ROM, or the list would be generated at
  523. run-time in the information block (see above) in RAM.  It is the application's
  524. responsibility to verify the current availability of any mode returned by this
  525. Function through the Return Super VGA mode information (Function 1) call.  Some
  526. of the returned modes may not be available due to the video board's current
  527. memory and monitor configuration.
  528.  
  529. The TotalMemory field indicates the amount of memory installed on the VGA
  530. board.  Its value represents the number of 64kb blocks of memory currently
  531. installed.
  532.  
  533.                       VESA Super VGA Standard VS911022-14
  534.  
  535. 6.3             Function 01h - Return Super VGA mode information
  536.  
  537. This function returns information about a specific Super VGA video mode that was
  538. returned by Function 0.  The function fills a mode information block structure
  539. at the address specified by the caller.  The mode information block size is
  540. maximum 256 bytes.
  541.  
  542. Some information provided by this function is implicitly defined by the VESA
  543. mode number.  However, some Super VGA implementations might support other video
  544. modes than those defined by VESA.  To provide access to these modes, this
  545. function also returns various other information about the mode.
  546.  
  547.         Input:  AH = 4Fh        Super VGA support
  548.                 AL = 01h        Return Super VGA mode information
  549.                 CX = Super VGA video mode
  550.                      (mode number must be one of those returned by Function 0)
  551.                 ES:DI = Pointer to 256 byte buffer
  552.  
  553.         Output: AX = Status
  554.                 (All other registers are preserved)
  555.  
  556. The mode information block has the following structure:
  557.  
  558. ModeInfoBlock   STRUC
  559.  
  560. ; mandatory information
  561.  
  562.         ModeAttributes      dw  ?  ; mode attributes
  563.         WinAAttributes      db  ?  ; window A attributes
  564.         WinBAttributes      db  ?  ; window B attributes
  565.         WinGranularity      dw  ?  ; window granularity
  566.         WinSize             dw  ?  ; window size
  567.         WinASegment         dw  ?  ; window A start segment
  568.         WinBSegment         dw  ?  ; window B start segment
  569.         WinFuncPtr          dd  ?  ; pointer to windor function
  570.         BytesPerScanLine    dw  ?  ; bytes per scan line
  571.  
  572. ; formerly optional information (now mandatory)
  573.  
  574.         XResolution         dw  ?  ; horizontal resolution
  575.         YResolution         dw  ?  ; vertical resolution
  576.         XCharSize           db  ?  ; character cell width
  577.         YCharSize           db  ?  ; character cell height
  578.         NumberOfPlanes      db  ?  ; number of memory planes
  579.         BitsPerPixel        db  ?  ; bits per pixel
  580.         NumberOfBanks       db  ?  ; number of banks
  581.         MemoryModel         db  ?  ; memory model type
  582.         BankSize            db  ?  ; bank size in kb
  583.         NumberOfImagePages  db  ?  ; number of images
  584.         Reserved            db  1  ; reserved for page function
  585.  
  586.                       VESA Super VGA Standard VS911022-15
  587.  
  588. ; new Direct Color fields
  589.  
  590.         RedMaskSize         db  ?  ; size of direct color red mask in bits
  591.         RedFieldPosition    db  ?  ; bit position of LSB of red mask
  592.         GreenMaskSize       db  ?  ; size of direct color green mask in bits
  593.         GreenFieldPosition  db  ?  ; bit position of LSB of green mask
  594.         BlueMaskSize        db  ?  ; size of direct color blue mask in bits
  595.         BlueFieldPosition   db  ?  ; bit position of LSB of blue mask
  596.         RsvdMaskSize        db  ?  ; size of direct color reserved mask in bits
  597.         DirectColorModeInfo db  ?  ; Direct Color mode attributes
  598.         Reserved            db  216 dup(?)      ; remainder of ModeInfoBlock
  599. ModeInfoBlock   ENDS
  600.  
  601. The ModeAttributes field describes certain important characteristics of the
  602. video mode.  Bit D0 specifies whether this mode can be initialized in the
  603. present video configuration.  This bit can be used to block access to a video
  604. mode if it requires a certain monitor type, and that this monitor is presently
  605. not connected.  Prior to Version 1.2 of the VESA BIOS Extension, it was not
  606. required that the BIOS return valid information for the fields after
  607. BytesPerScanline.  Bit D1 was used to signify if the optional information was
  608. present.  Version 1.2 of the VBE requires that all fields of the ModeInfoBlock
  609. contain valid data, except for the Direct Color fields, which are valid only if
  610. MemoryModel field is set to a 6 (Direct Color) or 7 (YUV).  Bit D1 is now
  611. reserved, and must be set to a 1.  Bit D2 indicates whether the BIOS has support
  612. for output functions like TTY output, scroll, pixel output, etc. in this mode
  613. (it is recommended, but not mandatory, that the BIOS have support for all output
  614. functions).  If bit D2 is 1 then the BIOS must support all of the standard
  615. output functions.
  616.  
  617. The field is defined as follows:
  618.  
  619.         D0 = Mode supported in hardware
  620.                 0 = Mode not supported in hardware
  621.                 1 = Mode supported in hardware
  622.         D1 = 1 (Reserved)
  623.         D2 = Output functions supported by BIOS
  624.                 0 = Output functions not supported by BIOS
  625.                 1 = Output functions supported by BIOS
  626.         D3 = Monochrome/color mode (see note below)
  627.                 0 = Monochrome mode
  628.                 1 = Color mode
  629.         D4 = Mode type
  630.                 0 = Text mode
  631.                 1 = Graphics mode
  632.         D5-D15 = Reserved
  633.  
  634.                       VESA Super VGA Standard VS911022-16
  635.  
  636. Note: Monochrome modes have their CRTC address at 3B4h.  Color modes have their
  637. CRTC address at 3D4h.  Monochrome modes have attributes in which only bit 3
  638. (video) and bit 4 (intensity) of the attribute controller output are
  639. significant.  Therefore, monochrome text modes have attributes of off, video,
  640. high intensity, blink, etc.  Monochrome graphics modes are two plane graphics
  641. modes and have attributes of off, video, high intensity, and blink.  Extended
  642. two color modes that have their CRTC address at 3D4h are color modes with one
  643. bit per pixel and one plane.  The standard VGA modes 06h and 11h would be
  644. classified as color modes, while the standard VGA modes 07h and 0Fh would be
  645. classified as monochrome modes.
  646.  
  647. The BytesPerScanline field specifies how many bytes each logical scanline
  648. consists of.  The logical scanline could be equal to or larger then the
  649. displayed scanline.
  650.  
  651.                       VESA Super VGA Standard VS911022-17
  652.  
  653. The WinAAttributes and WinBAttributes describe the characteristics of the CPU
  654. windowing scheme such as whether the windows exist and are read/writeable, as
  655. follows:
  656.  
  657.         D0 = Window supported
  658.                 0 = Window is not supported
  659.                 1 = Window is supported
  660.         D1 = Window readable
  661.                 0 = Window is not readable
  662.                 1 = Window is readable
  663.         D2 = Window writeable
  664.                 0 = Window is not writeable
  665.                 1 = Window is writeable
  666.         D3-D7 = Reserved
  667.  
  668. If windowing is not supported (bit D0 = 0 for both Window A and Window B), then
  669. an application can assume that the display memory buffer resides at the standard
  670. CPU address appropriate for the MemoryModel of the mode.
  671.  
  672. WinGranularity specifies the smallest boundary, in KB, on which the window can
  673. be placed in the video memory.  The value of this field is undefined if Bit D0
  674. of the appropriate WinAttributes field is not set.
  675.  
  676. WinSize specifies the size of the window in KB.
  677.  
  678. WinASegment and WinBSegment address specify the segment addresses where the
  679. windows are located in CPU address space.
  680.  
  681. WinFuncAddr specifies the address of the CPU video memory windowing function.
  682. The windowing function can be invoked either through VESA BIOS function 05h, or
  683. by calling the function directly.  A direct call will provide faster access to
  684. the hardware paging registers than using Int 10h, and is intended to be used by
  685. high performance applications.  If this field is Null, then Function 05h must be
  686. used to set the memory window, if paging is supported.
  687.  
  688. The XResolution and YResolution specify the width and height of the video mode.
  689. In graphics modes, this resolution is in units of pixels.  In text modes, this
  690. resolution is in units of characters.  Note that text mode resolutions, in units
  691. of pixels, can be obtained by multiplying XResolution and YResolution by the
  692. cell width and height, if the extended information is present.
  693.  
  694. The XCharCellSize and YCharSellSize specify the size of the character cell in
  695. pixels.
  696.  
  697. The NumberOfPlanes field specifies the number of memory planes available to
  698. software in that mode.  For standard 16-color VGA graphics, this would be set to
  699. 4.  For standard packed pixel modes, the field would be set to 1.
  700.  
  701. The BitsPerPixel field specifies the total number of bits that define the color
  702. of one pixel.  For example, a standard VGA 4 Plane 16-color graphics mode would
  703. have a 4 in this field and a packed pixel 256-color graphics mode would specify
  704. 8 in this field.  The number of bits per pixel per plane can normally be derived
  705. by dividing the BitsPerPixel field by the NumberOfPlanes field.
  706.  
  707.                       VESA Super VGA Standard VS911022-18
  708.  
  709. The MemoryModel field specifies the general type of memory organization used in
  710. this mode.  The following models have been defined:
  711.  
  712.         00h =           Text mode
  713.         01h =           CGA graphics
  714.         02h =           Hercules graphics
  715.         03h =           4-plane planar
  716.         04h =           Packed pixel
  717.         05h =           Non-chain 4, 256 color
  718.         06h =           Direct Color
  719.         07h =           YUV
  720.         08h-0Fh =       Reserved, to be defined by VESA
  721.         10h-FFh =       To be defined by OEM
  722.  
  723. In Version 1.1 and earlier of the VESA Super VGA BIOS Extension, OEM defined
  724. Direct Color video modes with pixel formats 1:5:5:5, 8:8:8, and 8:8:8:8 were
  725. described as a Packed Pixel model with 16, 24, and 32 bits per pixel,
  726. respectively.  In Version 1.2 and later of the VESA Super VGA BIOS Extension, it
  727. is recommended that Direct Color modes use the Direct Color MemoryModel and use
  728. the MaskSize and FieldPosition fields of the ModeInfoBlock to describe the pixel
  729. format.  BitsPerPixel is always defined to be the total memory size of the
  730. pixel, in bits.
  731.  
  732. The NumberOfBanks field specifies the number of banks in which the scan lines
  733. are grouped.  The remainder from dividing the scan line number by the number of
  734. banks is the bank that contains the scan line and the quotient is the scan line
  735. number within the bank.  For example, CGA graphics modes have two banks and
  736. Hercules graphics mode has four banks.  For modes that don't have scanline banks
  737. (such as VGA modes 0Dh-13h), this field should be set to 1.
  738.  
  739. The BankSize field specifies the size of a bank (group of scan lines) in units
  740. of 1KB.  For CGA and Hercules graphics modes this is 8, as each bank is 8192
  741. bytes in length.  For modes that don't have scanline banks (such as VGA modes
  742. 0Dh-13h), this field should be set to 0.
  743.  
  744. The NumberOfImagePages field specifies the number of additional complete display
  745. images that will fit into the VGA's memory, at one time, in this mode.  The
  746. application may load more than one image into the VGA's memory if this field is
  747. non-zero, and flip the display between them.
  748.  
  749. The Reserved field has been defined to support a future VESA BIOS extension
  750. feature and will always be set to one in this version.
  751.  
  752. The RedMaskSize, GreenMaskSize, BlueMaskSize, and RsvdMaskSize fields define the
  753. size, in bits, of the red, green, and blue components of a direct color pixel.
  754. A bit mask can be constructed from the MaskSize fields using simple shift
  755. arithmetic.  For example, the MaskSize values for a Direct Color 5:6:5 mode
  756. would be 5, 6, 5, and 0, for the red, green, blue, and reserved fields,
  757. respectively.  Note that in the YUV MemoryModel, the red field is used for V,
  758. the green field is used for Y, and the blue field is used for U.  The MaskSize
  759. fields should be set to 0 in modes using a MemoryModel that does not have pixels
  760. with component fields.
  761.  
  762.                       VESA Super VGA Standard VS911022-19
  763.  
  764. The RedFieldPosition, GreenFieldPosition, BlueFieldPosition, and
  765. RsvdFieldPosition fields define the bit position within the direct color pixel
  766. or YUV pixel of the least significant bit of the respective color component.  A
  767. color value can be aligned with its pixel field by shifting the value left by
  768. the FieldPosition.  For example, the FieldPosition values for a Direct Color
  769. 5:6:5 mode would be 11, 5, 0, and 0, for the red, green, blue, and reserved
  770. fields, respectively.  Note that in the YUV MemoryModel, the red field is used
  771. for V, the green field is used for Y, and the blue field is used for U.  The
  772. FieldPosition fields should be set to 0 in modes using a MemoryModel that does
  773. not have pixels with component fields.
  774.  
  775. The DirectColorModeInfo field describes important characteristics of direct
  776. color modes.  Bit D0 specifies whether the color ramp of the DAC is fixed or
  777. programmable.  If the color ramp is fixed, then it can not be changed.  If the
  778. color ramp is programmable, it is assumed that the red, green, and blue lookup
  779. tables can be loaded using a standard VGA DAC color registers BIOS call
  780. (AX=1012h).  Bit D1 specifies whether the bits in the Rsvd field of the direct
  781. color pixel can be used by the application or are reserved, and thus unusable.
  782.  
  783.         D0 = Color ramp is fixed/programmable
  784.                 0 = Color ramp is fixed
  785.                 1 = Color ramp is programmable
  786.         D1 = Bits in Rsvd field are usable/reserved
  787.                 0 = Bits in Rsvd field are reserved
  788.                 1 = Bits in Rsvd field are usable by the application
  789.  
  790. Notes
  791. ~~~~~
  792. Version 1.1 and later VESA BIOS extensions will zero out all unused fields in
  793. the Mode Information Block, always returning exactly 256 bytes.  This
  794. facilitates upward compatibility with future versions of the standard, as any
  795. newly added fields will be designed such that values of zero will indicate
  796. nominal defaults or non-implementation of optional features (for example, a
  797. field containing a bit-mask of extended capabilities would reflect the absence
  798. of all such capabilities).  Applications that wish to be backwards compatible to
  799. Version 1.0 VESA BIOS extensions should pre-initialize the 256 byte buffer
  800. before calling Return Super VGA mode information.
  801.  
  802.                       VESA Super VGA Standard VS911022-20
  803.  
  804. 6.4             Function 02h - Set Super VGA video mode
  805.  
  806. This function initializes a video mode.  The BX register contains the mode to
  807. set.  The format of VESA mode numbers is described in chapter 2.  If the mode
  808. cannot be set, the BIOS should leave the video environment unchanged and return
  809. a failure error code.
  810.  
  811.         Input:  AH = 4Fh        Super VGA support
  812.                 AL = 02h        Set Super VGA video mode
  813.                 BX = Video mode
  814.                      D0-D14 = Video mode
  815.                      D15 = Clear memory flag
  816.                            0 = Clear video memory
  817.                            1 = Don't clear video memory
  818.  
  819.         Output: AX = Status
  820.                 (All other registers are preserved)
  821.  
  822. 6.5             Function 03h - Return current video mode
  823.  
  824. This function returns the current video mode in BX.  The format of VESA video
  825. mode numbers is described in chapter 2 of this document.
  826.  
  827.         Input:  AH = 4Fh        Super VGA support
  828.                 AL = 03h        Return current video mode
  829.  
  830.         Output: AX = Status
  831.                 BX = Current video mode
  832.                 (All other registers are preserved)
  833.  
  834. Notes
  835. ~~~~~
  836. In a standard VGA BIOS, function 0Fh (Read current video state) returns the
  837. current video mode in the AL register.  In D7 of AL, it also returns the status
  838. of the memory clear bit (D7 of 40:87).  This bit is set if the mode was set
  839. without clearing memory.  In this Super VGA function, the memory clear bit will
  840. not be returned in BX since the purpose of the function is to return the video
  841. mode only.  If an application wants to obtain the memory clear bit, it should
  842. call VGA BIOS function 0Fh.
  843.  
  844.                       VESA Super VGA Standard VS911022-21
  845.  
  846. 6.6             Function 04h - Save/Restore Super VGA video state
  847.  
  848. These functions provide a mechanism to save and restore the Super VGA video
  849. state.  The functions are a superset of the three subfunctions under standard
  850. VGA BIOS function 1Ch (Save/restore video state).  The complete Super VGA video
  851. state (except video memory) should be saveable/restoreable by setting the
  852. requested states mask (in the CX register) to 000Fh.
  853.  
  854.         Input:  AH = 4Fh        Super VGA support
  855.                 AL = 04h        Save/restore Super VGA video state
  856.                 DL = 00h        Return save/restore state buffer size
  857.                 CX = Requested states
  858.                         D0 = Save/restore video hardware state
  859.                         D1 = Save/restore video BIOS data state
  860.                         D2 = Save/restore video DAC state
  861.                         D3 = Save/restore Super VGA state
  862.  
  863.         Output: AX = Status
  864.                 BX = Number of 64-byte blocks to hold the state buffer
  865.                 (All other registers are preserved)
  866.  
  867.  
  868.         Input:  AH = 4Fh        Super VGA support
  869.                 AL = 04h        Save/restore Super VGA video state
  870.                 DL = 01h        Save Super VGA video state
  871.                 CX = Requested states (see above)
  872.                 ES:BX = Pointer to buffer
  873.  
  874.         Output: AX = Status
  875.                 (All other registers are preserved)
  876.  
  877.  
  878.         Input:  AH = 4Fh        Super VGA support
  879.                 AL = 04h        Save/restore Super VGA video state
  880.                 DL = 02h        Restore Super VGA video state
  881.                 CX = Requested states (see above)
  882.                 ES:BX = Pointer to buffer
  883.  
  884.         Output: AX = Status
  885.                 (All other registers are preserved)
  886.  
  887. Notes
  888. ~~~~~
  889. Due to the goal of complete compatibility with the VGA environment, the standard
  890. VGA BIOS function 1Ch (Save/restore VGA state) has not been extended to save the
  891. Super VGA video state.  VGA BIOS compatibility requires that function 1Ch
  892. returns a specific buffer size with specific contents, in which there is no room
  893. for the Super VGA state.
  894.  
  895.                       VESA Super VGA Standard VS911022-22
  896.  
  897. 6.7             Function 05h - CPU Video Memory Window Control
  898.  
  899. This function sets or gets the position of the specified window in the video
  900. memory.  The function allows direct access to the hardware paging registers.  To
  901. use this function properly, the software should use VESA BIOS Function 01h
  902. (Return Super VGA mode information) to determine the size, location, and
  903. granularity of the windows.
  904.  
  905.         Input:  AH = 4Fh        Super VGA support
  906.                 AL = 05h        Super VGA video memory window control
  907.                 BH = 00h        Select Super VGA video memory window
  908.                 BL = Window number
  909.                         0 = Window A
  910.                         1 = Window B
  911.                 DX = Window position in video memory
  912.                      (in window granularity units)
  913.  
  914.         Output: AX = Status
  915.                 (See notes below)
  916.  
  917.  
  918.         Input:  AH = 4Fh        Super VGA support
  919.                 AL = 05h        Super VGA video memory window control
  920.                 BH = 01h        Return Super VGA video memory window
  921.                 BL = Window number
  922.                         0 = Window A
  923.                         1 = Window B
  924.  
  925.         Output: AX = Status
  926.                 DX = Window position in video memory
  927.                      (in window granularity units)
  928.                 (See notes below)
  929.  
  930. Notes
  931. ~~~~~
  932. This function is also directly accessible through a far call from the
  933. application.  The address of the BIOS function may be obtained by using VESA
  934. BIOS Function 01h, Return Super VGA mode information.  A field in the
  935. ModeInfoBlock contains the address of this function.  Note that this function
  936. may be different among video modes in a particular BIOS implementation, so the
  937. function pointer should be obtained after each set mode.
  938.  
  939. In the far call version, no status information is returned to the application.
  940. Also, the AX and DX registers will be destroyed.  Therefore, if AX and/or DX
  941. must be preserved, the application must do so priot to making the far call.
  942.  
  943. The application must load the input arguments in BH, BL, and DX (for set window)
  944. but does not need to load either AH or AL in order to use the far call version
  945. of this function.
  946.  
  947.                       VESA Super VGA Standard VS911022-23
  948.  
  949. 6.8             Function 06h - Set/Get Logical Scan Line Length
  950.  
  951. This function sets or gets the length of a logical scan line.  This function
  952. allows an application to set up a logical video memory buffer that is wider than
  953. the displayed area.  Function 07h then allows the application to set the
  954. starting position that is to be displayed.
  955.  
  956.         Input:  AH = 4Fh        Super VGA support
  957.                 AL = 06h        Logical Scan Line Length
  958.                 BL = 00h        Select Scan Line Length
  959.                 CX = Desired width in pixels
  960.  
  961.         Output: AX = Status
  962.                 BX = Bytes Per Scan Line
  963.                 CX = Actual Pixels Per Scan Line
  964.                 DX = Maximum Number of Scan Lines
  965.  
  966.  
  967.         Input:  AH = 4Fh        Super VGA support
  968.                 AL = 06h        Logical Scan Line Length
  969.                 BL = 01h        Return Scan Line Length
  970.  
  971.         Output: AX = Status
  972.                 BX = Bytes Per Scan Line
  973.                 CX = Actual Pixels Per Scan Line
  974.                 DX = Maximum Number of Scan Lines
  975.  
  976. Notes
  977. ~~~~~
  978. The desired width in pixels may not be achieveable because of VGA hardware
  979. considerations.  The next larger value will be selected thta will accommodate
  980. the desired number of pixels, and the actual number of pixels will be returned
  981. in CX.  BX returns a value that, when added to a pointer into video memory, will
  982. point to the next scan line.  For example, in a mode 13h this would be 320, but
  983. in mode 12h this would be 80.  DX returns the number of logical scan lines based
  984. upon the new scan line length and the total memory installed and useable in this
  985. display mode.  This function is also valid in text modes.  In text modes, the
  986. application should find out the current character cell width through normal BIOS
  987. functions, multiply that times the desired number of characters per line, and
  988. pass the value in the CX register.
  989.  
  990.                       VESA Super VGA Standard VS911022-24
  991.  
  992. 6.9             Function 07h - Set/Get Display Start
  993.  
  994. This function selects the pixel to be displayed in the upper left corner of the
  995. display from the logical page.  This function can be used to pan and scroll
  996. around logical screens that are larger than the displayed screen.  This function
  997. can also be used to rapidly switch between two different displayed screens for
  998. double buffered animation effects.
  999.  
  1000.         Input:  AH = 4Fh        Super VGA support
  1001.                 AL = 07h        Display Start Control
  1002.                 BH = 00h        Reserved and must be 0
  1003.                 BL = 00h        Select Display Start
  1004.                 CX = First Displayed Pixel in Scan Line
  1005.                 DX = First Displayed Scan Line
  1006.  
  1007.         Output: AX = Status
  1008.  
  1009.  
  1010.         Input:  AH = 4Fh        Super VGA support
  1011.                 AL = 07h        Display Start Control
  1012.                 BL = 01h        Return Display Start
  1013.  
  1014.         Output: AX = Status
  1015.                 BH = 00h Reserved and will be 0
  1016.                 CX = First Displayed Pixel in Scan Line
  1017.                 DX = First Displayed Scan Line
  1018.  
  1019. Notes
  1020. ~~~~~
  1021. This function is also valid in text modes.  In text modes, the application
  1022. should find out the current character cell width through normal BIOS functions,
  1023. multiply that times the desired starting character column, and pass that value
  1024. in the CX register.  It should also multiply the current character cell height
  1025. times the desired starting character row, and pass that value in the DX
  1026. register.
  1027.  
  1028.                       VESA Super VGA Standard VS911022-25
  1029.  
  1030. 6.10            Function 08h - Set/Get DAC Palette Control
  1031.  
  1032. This function queries and selects the operating mode of the DAC palette.  Some
  1033. DACs are configurable to provide 6-bits, 8-bits, or more of color definition per
  1034. red, green, and blue primary color.  The DAC palette width is assumed to be
  1035. reset to standard VGA 6-bits per primary during a standard or VESA Set Super VGA
  1036. Mode (AX = 4F02h) call.
  1037.  
  1038.         Input:  AH = 4Fh        Super VGA support
  1039.                 AL = 08h        Set/Get DAC Palette Control
  1040.                 BL = 00h        Set DAC palette width
  1041.                 BH = Desired number of bits of color per primary
  1042.                      (Standard VGA = 6)
  1043.  
  1044.         Output: AX = Status
  1045.                 BH = Current number of bits of color per primary
  1046.                 (Standard VGA = 6)
  1047.  
  1048.  
  1049.         Input:  AH = 4Fh        Super VGA support
  1050.                 AL = 08h        Set/Get DAC Palette Control
  1051.                 BL = 01h        Get DAC palette width
  1052.  
  1053.         Output: AX = Status
  1054.                 BH = Current number of bits of color per primary
  1055.                 (Standard VGA = 6)
  1056.  
  1057. Notes
  1058. ~~~~~
  1059. An application can find out if DAC switching is available by querying Bit D0 of
  1060. the Capabilities field of the VgaInfoBlock structure returned by VESA Return
  1061. Super VGA Information (AX = 4F00h).  The application can then attempt to set the
  1062. DAC palette width to the desired value.  If the Super VGA is not capable of
  1063. selecting the requested palette width, then the next lower value that the Super
  1064. VGA is capable of will be selected.  The resulting palette width is returned.
  1065.  
  1066.                       VESA Super VGA Standard VS911022-26
  1067.  
  1068. 7.      Application Example
  1069. ~~~~~~~~~~~~~~~~~~~~~~~~~~~
  1070. The following sequence illustrates how an application interface to the VESA BIOS
  1071. Extension.  The hypothetical application is VESA-aware and calls the VESA BIOS
  1072. functions.  However, the application is not limited to supporting just
  1073. VESA-defined video modes.  This it will inquire what video modes are available
  1074. before setting up the video mode.
  1075.  
  1076. 1)      The application would first allocate a 256 byte buffer.  This buffer
  1077.         will be used by the VESA BIOS to return information about the video
  1078.         environment.  Some applications will statically allocate this buffer,
  1079.         others will use system calls to temporarily obtain buffer space.
  1080.  
  1081. 2)      The application would then call VESA BIOS function 00h (Return Super VGA
  1082.         information).  If the AX register does not contain 004Fh on return from
  1083.         the function call, the application can determine that the VESA BIOS
  1084.         Extension is not present and handle such situation.
  1085.  
  1086.         If no error code is passed in AX, the function call was successful.  The
  1087.         buffer has been filled by the VESA BIOS Extension with various
  1088.         information.  The application can verify that indeed this is a valid
  1089.         VESA block by identifying the characters 'VESA' in the beginning of the
  1090.         block.  The application can inspect the VESAVersion field to determine
  1091.         whether the VESA BIOS Extension ha sufficient functionality.  The
  1092.         application may use the OEMStringPtr to locate OEM-specific information.
  1093.  
  1094.         Finally, the application can obtain a list of the supported Super VGA
  1095.         modes by using the VideoModePtr.  This field points to a list of the
  1096.         video modes supported by the video environment.
  1097.  
  1098. 3)      The application would then create a new buffer and call the VESA BIOS
  1099.         function 01h (Return Super VGA mode information) to obtain information
  1100.         about the supported video modes.  Using the VideoModePtr obtained in
  1101.         step 2) above, the application would call this function with a new mode
  1102.         number until a suitable video mode is found.  If no appropriate video
  1103.         mode is found, it is up to the application to handle this situation.
  1104.  
  1105.         The Return Super VGA mode information function fills a buffer specified
  1106.         by the application with information describing the features of the video
  1107.         mode.  The data block contains all the information an application needs
  1108.         to take advantage of the video mode.
  1109.  
  1110.         The application would examine the ModeAttributes field.  To verify that
  1111.         the mode indeed is supported, the application would inspect bit D0.  If
  1112.         D0 is clear, then the mode is not supported by the hardware.  This might
  1113.         happen is a specific mode requires a certain type of monitor but that
  1114.         monitor is not present.
  1115.  
  1116. 4)      After the application has selected a video mode, the next step is to
  1117.         initialize the mode.  However, the application might first want to save
  1118.         the present video mode.  When the application exits, this mode would be
  1119.         restored.  To obtain the present video mode, the VESA BIOS function 03h
  1120.         (Get Super VGA mode) would be used.  If a non-VESA (standard VGA or
  1121.         OEM-specific) mode is in effect, only the lower byte in the mode number
  1122.         is filled.  The upper byte is cleared.
  1123.  
  1124. 5)      To initialize the video mode, the application would use VESA BIOS
  1125.         function 02h (Set Super VGA mode).  The application has from this point
  1126.         on full access to the VGA hardware and video memory.
  1127.  
  1128.                       VESA Super VGA Standard VS911022-27
  1129.  
  1130. 6)      When the application is about to terminate, it would restore the prior
  1131.         video mode.  The prior video mode, obtained in step 4) above could be
  1132.         either a standard VGA mode, OEM-specific mode, or VESA-supported mode.
  1133.         It would reinitialize the video mode by calling VESA BIOS function 02h
  1134.         (Set Super VGA mode).  The application would then exit.
  1135.